package me.jiatao.jetpack.databinding;

import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.Toast;

/**
 * Created by JiaTao on 2018/9/30.
 * Email: 535318720@qq.com
 * Version: 1.0
 * Description:
 */
public class MyEventHanding {

    private static final String TAG = "***MyEventHanding***";

    public void onButtonClick(View view) {
        Button button = (Button) view;
        Log.i(TAG, "onButtonClick---------->" + button.getText().toString());
        Toast.makeText(view.getContext(), button.getText(), Toast.LENGTH_SHORT).show();
    }

    public void onCheckedChanged(View view, boolean completed) {
        CheckBox checkBox = (CheckBox) view;
        Toast.makeText(view.getContext(), checkBox.getText() + "--->" + completed, Toast.LENGTH_SHORT).show();
    }

    public boolean onLongClick(View view) {
        Button button = (Button) view;
        Toast.makeText(view.getContext(), button.getText(), Toast.LENGTH_SHORT).show();
        return true;
    }

    public void logUserInfo(View view) {
        User user= (User) view.getTag();
        Toast.makeText(view.getContext(),user.toString(), Toast.LENGTH_SHORT).show();
    }
}
